import React, { Component } from 'react'

export default class Child extends Component {
  handleClick = () => {
    // #2 调用传递过来的回调函数
    this.props.changeCar('奔驰')
  }
  render() {
    return (
      <div>
        {/* <button
          onClick={() => {
            // #2 调用传递过来的回调函数
            this.props.changeCar('奔驰')
          }}
        >
          点我，奥拓变奔驰
        </button> */}
        <button onClick={this.handleClick}>点我，奥拓变奔驰</button>
      </div>
    )
  }
}
